package com.xxxx.server.utils;

import com.xxxx.server.pojo.Admin;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

/**
 * @Author : ymd
 * @Date : 2020/10/16 0016 9:04
 * @Version 1.0
 * @Description : 获取SecurityContext中的用户对象
 */
//@Component
public class GetAdminUtils {

    public static Admin getAdmin (){
        return (Admin)
                SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
}
